 <?php

  //header('Access-Control-Allow-Origin:*'); // CORS

 // $_REQUEST用于接收表单数据
 //$password = $_REQUEST['password'];
 //$username = $_REQUEST['username'];


  //include('./conn.php');

  //$sql = "select * from users where username='$username'";
  //$res = $conn->query($sql);

  ///if($res->num_rows>0){
   // echo '{"message":"用户名已存在","error":null,"error_no":0,"has":true,"color":"red","password":"'.$password.'"}';
 // }else{
  //  echo '{"message":"用户名或密码不正确","error":null,"error_no":0,"has":false,"color":"green","password":"'.$password.'"}';
 // }
 $username = $_REQUEST['username'];
 $password = $_REQUEST['password'];
 
// echo $username;
// echo $password;

 include('./conn.php');

 $sql = "select * from users where username='$username'";
// $sql = "select username='$username',password='$password' from users";
 //$res = $conn->query($sql);
//echo $res;
 if($res->num_rows>0){
   echo '{"message":"用户名已存在","error":null,"error_no":0,"has":true,"color":"red","username":"'.$username.'"}';
 }else{
   echo '{"message":"用户名或密码不正确","error":null,"error_no":0,"has":false,"color":"green","username":"'.$username.'"}';
 }
?> 